<template>
  <div id="app">
    <nav>
      这里是vue2
      <div>{{$store.state.qkstore}}</div>
      <Hello/> 
 
      <QiankunCDemo msg="哈哈哈哈"/>
      <PropsComShow/>
      <router-link to="/">Home</router-link>
      |
      <router-link to="/about">About</router-link>
    </nav>
    <router-view />
  </div>
</template>
<script>
 import PropsComShow from '@/components/PropsComShow.vue'
 import store  from '@/store'
//  store?.state?.qkstore?.components?.HelloWorld
 export default  {
components:{PropsComShow,
Hello:()=>{
  if(!window.commonComponent){
        // 独立运行时
        window.commonComponent = {};
      }
      const HelloWorld = window.commonComponent.HelloWorld;
      console.log(HelloWorld);
      return HelloWorld || (window.commonComponent.HelloWorld =
             import('@/components/HelloWorld.vue'));
   }
 },
computed:{
  Hello(){
    console.log(store?.state?.qkstore?.components?.HelloWorld);
    return store?.state?.qkstore?.components?.HelloWorld
  }
}
}
</script>

<style lang="less">
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}

nav {
  padding: 30px;

  a {
    font-weight: bold;
    color: #2c3e50;

    &.router-link-exact-active {
      color: #42b983;
    }
  }
}
</style>
